package com.xhj.springbootproject.config;

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

/**
 * @author ：Xionghaijun
 * @date ：Created in 2019/9/25 3:54 PM
 * @description：
 */
@Component
public class ErrorConfig implements ErrorPageRegistrar {
    @Override
    public void registerErrorPages(ErrorPageRegistry registry) {
        ErrorPage error403Page = new ErrorPage(HttpStatus.FORBIDDEN, "/error403Page");
        ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/error404Page");
        registry.addErrorPages(error403Page,error404Page);
    }
}
